package com.colorlight.cloud.gateway.api.exception;



import com.colorlight.cloud.common.exception.BaseException;
import com.colorlight.cloud.common.model.enums.api.ExceptionInterface;
import com.colorlight.cloud.gateway.api.exception.enums.ReflexExceptionEnum;

/**
 * @author Demon
 */
public class ReflexException extends BaseException {
	private static final long serialVersionUID = -1708097317609308820L;
	
	ExceptionInterface<? extends Enum<?>> resultCodeEnum;
	/**
	 * 异常信息
	 */
	private final String message;
	
	public ReflexException(String message) {
		super(message);
		this.resultCodeEnum = ReflexExceptionEnum.REFLEX_DEFAULT_EXCEPTION;
		this.message = message;
	}
	
	public ReflexException(ExceptionInterface<?> resultCodeEnum, String message) {
		super(resultCodeEnum,message);
		this.resultCodeEnum = resultCodeEnum;
		this.message = message;
	}
	
	public ReflexException(ExceptionInterface<?> resultCodeEnum) {
		super(resultCodeEnum);
		this.resultCodeEnum = resultCodeEnum;
		this.message = resultCodeEnum.getThisDescription();
	}
	
	@Override
	public String getMessage() {
		return message;
	}
	
	@Override
	public ExceptionInterface<? extends Enum<?>> getResultCodeEnum() {
		return resultCodeEnum;
	}
}
